<?php
/**
 * File: addDept
 * This Form allows a student to add a specific department to the database after selecting a school
 */

class Admin_Form_schooldept extends Zend_Dojo_Form {
	
	
	public function __construct($options = null){		
		parent::__construct($options);
		Zend_Dojo::enableForm($this);
	 
	
	$AllSchool = new Admin_Model_DbTable_School();
	 $arr = $AllSchool->getSchools();
	 
	/**
	 * This gets all the schools from the school table.
	 * @var unknown_type
	 */
	$schools = new Zend_Dojo_Form_Element_FilteringSelect('school');
	foreach ($arr as $school){
   $schools->addMultiOption($school->id, $school->name);
	}
	
	$AllDepts = new Admin_Model_DbTable_Department();
	$arr = $AllDepts->fetchAll();
	

	/**
	 * This gets all the departments from the departments table
	 * @var unknown_type
	 */
	$dept = new Zend_Dojo_Form_Element_FilteringSelect('dept');
	foreach ($arr as $depts){
		$dept->addMultiOption($depts->id, $depts->name);
	}
	
	$submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
	$this->addElements(array($schools, $dept, $submit));
	$this->setMethod('post');
	
	}
}